/* 
 * File:   repository.hpp
 * Author: jolo
 *
 * Created on 10. Oktober 2011, 17:42
 */

#ifndef MODEL_REPOSITORY_HPP
#define	MODEL_REPOSITORY_HPP

#include "entity.hpp"

#include "project.hpp"
#include "chemical_element.hpp"

namespace model
{

    class repository : public entity
    {
    public:
        repository(const string& path = "");
        
        virtual ~repository();

        virtual string path() const
        {
            return path_;
        }

        void set_path(const string& p)
        {
            path_ = p;
        }

        
        project_vector projects() const {
            return projects_;
        }
        
        chemical_element_vector chemical_elements() const {
            return chemical_elements_;
        }
        
        void print_on(std::ostream& s);
        virtual const string to_string() const;
        virtual void bootstrap_data();
        virtual const string object_name() const;

        virtual project_ptr create_project(const string& name);
        virtual chemical_element_ptr create_chemical_element(const string& symbol,
                                                             const string& name,
                                                             const string& group,
                                                             const string& period,
                                                             const double atomic_weight,
                                                             const int number,
                                                             const string& description = "");

        virtual const string short_label() const;
        
    protected:
        virtual void bootstrap_elements();
        virtual void bootstrap_project();

    private:
        friend class boost::serialization::access;

        template<class Archive>
        void serialize(Archive & ar, const unsigned int version)
        {
            (void) version;
            ar & boost::serialization::base_object<entity > (*this);
            ar & path_;
            ar & projects_;
            ar & chemical_elements_;
        }

        string path_;
        project_vector projects_;
        chemical_element_vector chemical_elements_;
    };
}

#endif	

